import {baseUrl} from '@/libs/api.request'
import axios from '@/libs/api.request'
import { getToken,getUserId,getCompanyId } from '@/libs/util'

export const saveErrorLogger = info => {
  return axios.request({
    url: 'save_error_logger',
    data: info,
    method: 'post'
  })
}
/**
 * 图片上传
 * @param {*} params
 */
export const upLoadImg = (params,type,loading) => {
    return axios.request({
      url: '/file/upload/'+type,
      data: params,
      method: 'post',
      isLoading:loading,
      headers:{
        // 'yjyToken':getToken(),
        // 'yjyUserId':getUserId(),
        // 'yjyCompanyId': getCompanyId(),
        "Content-Type": "multipart/form-data"
      }
    })
  }
  
export const getImgUrl = (url)=>{
  if ( !!url && url.indexOf("http") == 0) {
    return url;
  }
	return baseUrl+'/file/get/'+ url;
}

//获取头像
export const getHeadImg = (url)=>{
	return baseUrl+'/file/headimg/'+ url;
}

/**
 * 字典接口
 * @param {*} 根据typeIds获取字典 获取多个用逗号分割 （get请求）
 */
export const getDictionary = (typeIds) => { 
    return axios.request({
        url: '/dictionary/dictionary',
        params: typeIds,
        method: 'get'
    })
}


